package com.project.petLossSystem.mapper;

import com.project.petLossSystem.po.PetPost;
import com.project.petLossSystem.util.PageQueryUtil;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

@Mapper
public interface PetPostMapper {
    int insertPost(PetPost petPost);// 插入

    List<PetPost> postList(PageQueryUtil pageQueryUtil);

    long postCount(PageQueryUtil pageQueryUtil);

    int deletePosts(@Param("postIds") Long[] postIds);

    List<PetPost> getPostsForViews(@Param("number") int number); // 获取热度帖子列表

    List<PetPost> getPostsForTime(@Param("number") int number, @Param("postType") byte postType); // 获取新帖子列表

    PetPost getPostById(@Param("postId") Long postId);

    List<PetPost> getPostsByUserId(@Param("userId") Long userId);

    List<PetPost> postListForSearch(PageQueryUtil pageQueryUtil);

    long postCountForSearch(PageQueryUtil pageQueryUtil);

    int updateViews(@Param("viewsMap") Map<String, Long> viewsMap);

    long getCountTodayByType(@Param("postType") Byte postType);

    long getIdByMainImageUrl(@Param("mainImageUrl") String mainImageUrl);

    List<Long> getPostIdsByCategoryAndTypeAndAddress(@Param("petCategoryId") Long petCategoryId, @Param("postType") Byte postType, @Param("addressCategoryId") Integer addressCategoryId, @Param("userId") Long userId);

    List<PetPost> postListForMatch(@Param("map") PageQueryUtil pageQueryUtil, @Param("list") List<String> postIds);
}
